package battleships;
/**
* Title: 
* Description: 
* @mainauthor:
* @email 
* @editors:
* @lastupdate: 
* 
*/

import java.io.File;
import java.io.IOException;

import javax.xml.parsers.*;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;

import org.w3c.dom.Document;
import org.xml.sax.SAXException;

public class readPlayer {
	final static String name = "Bob";

	public static void main(String[] args) {

		try {

			DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
					.newInstance();
			DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
			Document doc = docBuilder.parse(new File("src/player.xml"));

		} catch (ParserConfigurationException e) {
			System.err.println("Not able to create DocumentBuilder object!");
			e.printStackTrace();
		} catch (SAXException e) {
			System.err.println("Not able to read file");
			e.printStackTrace();
		} catch (IOException e) {
			System.err.println("Not able to open file");
			e.printStackTrace();

			XPath path = XPathFactory.newInstance().newXPath();

			String playerName = "/players/" + name;
			String turns = "/players/" + name + "/turns";
			String time = "/players/" + name + "/time";

			System.out.println(playerName);

		}

		catch (NumberFormatException e) {
			System.err.println("Not able to read number.");
			e.printStackTrace();
		}
	}

}
